/* INTRO.C
 * MULE intro. Currently only imagination-logo
 *************
 * 29.08.2000 : Toni R„s„nen
 *              modifications/documentation for open source
 *
 */

#include <stdlib.h>
#include <stdio.h>
#include "gfx2.h"
#include "timer.h"
#include "keys.h"
#include "mainmenu.h"
#include "pakfile.h"

volatile int intro_timer;

void intro_timerrout()
{  if (intro_timer) intro_timer--;
}

void mule_intro()
{  int last_introtimer;
   purakuva ("ilogo.dat", ruutu);
   setpale (0,0,0); flip();

   timer_routine = intro_timerrout;

   intro_timer = 150;
   last_introtimer = -1;

   while (1)
     {  if (keybuffer[1]) break;

        if (last_introtimer != intro_timer)
          {  last_introtimer = intro_timer;
             if (intro_timer < 31) setpale (intro_timer*2,intro_timer*2,intro_timer*2);
             if (intro_timer > 150-31) setpale ((150-intro_timer)*2,(150-intro_timer)*2,(150-intro_timer)*2);
          }

        if (intro_timer <= 0) break;
     }

   keybuffer[1] = 0;

   timer_routine = NULL;

   memset (ruutu,0,64000);
   flip();
}
